using System;
using Castle.ActiveRecord;
using CosyTrade.Data;

namespace CosyTrade.Security
{
    [AddPropertyChangedNotifyInterface, PropertyChangedNotify]
    [Serializable, ActiveRecord("FunctionPowerSet")]
    public class FunctionPowerSet : BusinessObject
    {
        private readonly Guid primaryKey = Guid.NewGuid();
        private Function function;
        private Role role;
        private PowerSet powerSet;
        
        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access=PropertyAccess.NosetterCamelcase)]
        public Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        [BelongsTo("FunctionGuid", NotNull=true)]
        public Function Function
        {
            get { return function; }
            set { function = value; }
        }

        [BelongsTo("RoleGuid", NotNull = true)]
        public Role Role
        {
            get { return role; }
            set { role = value; }
        }

        [BelongsTo("PowersetGuid", NotNull = true)]
        public PowerSet PowerSet
        {
            get { return powerSet; }
            set { powerSet = value; }
        }
    }
}